package com.pro.service.imple;

import com.pro.mapper.JsUserFeedbackMapper;
import com.pro.pojo.JsUserFeedback;
import com.pro.service.JsUserFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * ClassName:JsUserFeedbackServiceImple
 * Package:com.pro.service.imple
 * Description: 意见反馈serviceImple
 *
 * @Date:2022/1/14 上午 11:38
 * @Author: WYH
 */
@Service
public class JsUserFeedbackServiceImple implements JsUserFeedbackService {

    @Autowired(required = false)
    private JsUserFeedbackMapper jsUserFeedbackMapper;

    /**
     * @Author WYH
     * @Description //TODO 查询所有反馈
     * @Date 上午 11:43 2022/1/14
     * @Param feedbackType,feedbackStatus,limit,page
     * @return List<JsUserFeedback>
     **/
    @Override
    public List<JsUserFeedback> getAllUserFeedBack(String feedbackType, String feedbackStatus, Integer limit, Integer page) {
        page = (page-1)*limit;
        List<JsUserFeedback> allUserFeedBack = jsUserFeedbackMapper.getAllUserFeedBack(feedbackType, feedbackStatus, limit, page);
        return allUserFeedBack;
    }

    /**
     * @Author WYH
     * @Description //TODO 计算所有反馈个数
     * @Date 上午 11:50 2022/1/14
     * @Param feedbackType,feedbackStatus,limit,page
     * @return List<JsUserFeedback>
     **/
    public Integer count(String feedbackType,String feedbackStatus){
        Integer count = jsUserFeedbackMapper.count(feedbackType, feedbackStatus);
        return count;
    }

    /**
     * @Author WYH
     * @Description //TODO 删除反馈
     * @Date 下午 3:40 2022/1/14
     * @Param feedbackId
     * @return  true | false
     **/
    public Boolean delFeebdack(Integer feedbackId){
        Boolean delFeebdack = jsUserFeedbackMapper.delFeebdack(feedbackId);
        return delFeebdack;
    }

    /**
     * @Author WYH
     * @Description //TODO 审核
     * @Date 下午 8:47 2022/1/14
     * @Param jsUserFeedback
     * @return  true | false
     **/
    public Boolean UpdateFeedback(JsUserFeedback jsUserFeedback){
        jsUserFeedback.setUpdateDate(new Date());
        Boolean updateFeedback = jsUserFeedbackMapper.UpdateFeedback(jsUserFeedback);
        return updateFeedback;
    }

    /**
     * @Author WYH
     * @Description //TODO 查询审核详情
     * @Date 上午 10:25 2022/1/15
     * @Param feedbackId
     * @return  JsUserFeedback
     **/
    public JsUserFeedback seeFeedback(Integer feedbackId){
        JsUserFeedback jsUserFeedback = jsUserFeedbackMapper.seeFeedback(feedbackId);
        return jsUserFeedback;
    }
}
